package com.jt.controller;

import com.jt.pojo.User;
import com.jt.service.UserService;
import com.jt.service.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin //跨域问题
@RequestMapping("/axios")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 需求：http://localhost:8080/axios/findAll
     * 返回：所有用户的数据
     */
    @GetMapping("/findAll")
    public List<User> findAll(){
        List<User> userList = userService.findAll();
        return userList;
    }
}
